package cn.edu.besti.cs1823.G2326;

import cn.edu.besti.cs1823.G2326.Sreaching;
import com.company.Contact;
import com.company.Searching;
import com.company.Sorting;

public class test {
    public static void main(String[] args) {
        com.company.Contact[] players = new com.company.Contact[3];
        com.company.Contact[] player = new com.company.Contact[3];

        players[0] = new com.company.Contact("y", "y", "2325");
        players[1] = new com.company.Contact("l", "yj", "2326");
        players[2] = new com.company.Contact("z", "th", "2327");

        player[0] = new com.company.Contact("z", "pn", "2301");
        player[1] = new com.company.Contact("w", "by", "2330");
        player[2] = new com.company.Contact("z", "dy", "2303");

        com.company.Contact target1 = new com.company.Contact("","","2303");
        com.company.Contact target2 = new com.company.Contact("","","0000");
        com.company.Contact target3 = new com.company.Contact("","","2326");
        com.company.Contact target4 = new com.company.Contact("","","1122");
        com.company.Contact target5 = new com.company.Contact("","","2325");

        com.company.Contact found[] = new com.company.Contact[10];
        found[0] = (com.company.Contact) Searching.linearSearch(player,target1);
        found[1] = (com.company.Contact)Searching.linearSearch(player,target2);
        found[2] = (com.company.Contact)Searching.linearSearch(player,target3);
        found[3] = (com.company.Contact)Searching.linearSearch(players,target4);
        found[4] = (com.company.Contact)Searching.linearSearch(players,target5);
        found[5] = (com.company.Contact)Searching.linearSearch(player,target5);
        found[6] = (com.company.Contact)Searching.linearSearch(players,target1);
        found[7] = (Contact)Searching.linearSearch(players,target3);

        for(int i=0;i<8;i++){
            System.out.println("Test"+(i+1)+":");
            if(found[i] == null)
                System.out.println("Player was not found.");
            else
                System.out.println("Found:  "+ found[i]);
        }

        com.company.Sorting.selectionSort(player);
        Sorting.selectionSort(players);

        System.out.println("Test9:");
        for(Comparable play :player)
            System.out.println(play);
        System.out.println("Test10:");
        for(Comparable play :players)
            System.out.println(play);


    }
}
